<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        /* 2 */
        .box {
            border: 2px solid #333;
            width: 400px;
            height: 400px;
            position: relative;

        }

        .box1 {
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            
        }

        /* 3 */
        /* .box {
            border: 2px solid #333;
            width: 400px;
            height: 400px;
            position: relative;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        } */
        /* 4 */
        /* .box {
            border: 2px solid #333;
            width: 400px;
            height: 400px;
            display: table-cell;
            text-align: center;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background: pink;
            display: inline-block;
            vertical-align: middle;
        } */
        /* 5 */
        /* .box {
            border: 2px solid #333;
            width: 400px;
            height: 400px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background: pink;
        } */
    </style>
</head>

<body>
    <div class="box">
        <div class="box1">

        </div>
    </div>
</body>

</html>